Simulation algorithms for coupled DEVS

From HandWiki

Given a coupled DEVS model, simulation algorithms are methods to generate the model's legal behaviors, which are a set of trajectories not to reach illegal states. (see behavior of a Coupled DEVS model.) [Zeigler84] originally introduced the algorithms that handle time variables related to lifespan

ts[0,]

and elapsed time

te[0,)

by introducing two other time variables, last event time,

tl[0,)

, and next event time

tn[0,]

with the following relations:

te=ttl

and

ts=tntl

where t[0,) denotes the current time. And the remaining time,

tr=tste

is equivalently computed as

tr=tnt,

apparently

tr[0,]

.

Based on these relationships, the algorithms to simulate the behavior of a given Coupled DEVS are written as follows.

Algorithm

algorithm DEVS-coordinator
  Variables:
     parent // parent coordinator
     tl: // time of last event
     tn: // time of next event
     N=(X,Y,D,{Mi},Cxx,Cyx,Cyy,Select) // the associated Coupled DEVS model
    when receive init-message(Time t)
        for each iD do
            send init-message(t) to child i
        tlmax{tli:iD};
        tnmin{tni:iD};
    when receive star-message(Time t)
        if ttn then
            error: bad synchronization;
        i*Select({iD:tni=tn});
        send star-message(t)to i*
        tlmax{tli:iD};
        tnmin{tni:iD};
    when receive x-message(xX, Time t)
        if (tlt and ttn) == false then
            error: bad synchronization;
        for each (x,xi)Cxx do
            send x-message(xi,t) to child i
        tlmax{tli:iD};
        tnmin{tni:iD};
    when receive y-message(yiYi, Time t)
        for each (yi,xi)Cyx do
            send x-message(xi,t) to child i
        if Cyy(yi)ϕ then
            send y-message(Cyy(yi), t) to parent;
        tlmax{tli:iD};
        tnmin{tni:iD};

See also

  • Coupled DEVS
  • Behavior of Coupled DEVS
  • Simulation Algorithms for Atomic DEVS

References

  • [Zeigler84] Bernard Zeigler (1984). Multifacetted Modeling and Discrete Event Simulation. Academic Press, London; Orlando. ISBN 978-0-12-778450-2. 
  • [ZKP00] Bernard Zeigler; Tag Gon Kim; Herbert Praehofer (2000). Theory of Modeling and Simulation (second ed.). Academic Press, New York. ISBN 978-0-12-778455-7.